#include <iostream>
#include <vector>

using namespace std;

const int N = 3330;
long long dp[10][N];
vector<int> edge[N];
int W = 32;
int H = 10;
vector<int> p;
int inL[32];

int seenP[65535];

int main() {
    for (int i = 0; i < (1 << 16); i++) {
        int len = 0;
        int currentI = 0;
        for (int j = 0; j < 16; j++) {
            if (i & (1 << j)) {
                len += 3;
                currentI |= 1 << j;
            }
            else
                len += 2;
            if (len == W && !seenP[currentI]) {
                seenP[currentI] = 1;
                p.push_back(currentI);
                break;
            }
            if (len > W)
                break;
        }
    }

    cout << p.size() << endl;
    int n = (int)(p.size());

    for (int i = 0; i < n; i++) {
        int pi = p[i];
        for (int j = i + 1; j < n; j++) {
            for (int k = 0; k < W; k++) inL[k] = 0;
            int pj = p[j];
            int l1 = 0, l2 = 0;
            for (int k = 0; k < 16; k++) {
                if (pi & (1 << k)) {
                    l1 += 3;
                } else {
                    l1 += 2;
                }
                if (l1 >= W)
                    break;
                inL[l1] = 1;
            }
            int good = 1;
            for (int k = 0; k < 16; k++) {
                if (pj & (1 << k))
                    l2 += 3;
                else
                    l2 += 2;
                if (l2 >= W)
                    break;
                if (inL[l2]) {
                    good = 0;
                    break;
                }
            }
            if (good) {
                edge[i].push_back(j);
                edge[j].push_back(i);
            }
        }
        cout << i << endl;
    }

    for (int i = 0; i < N; i++) {
        dp[0][i] = 1;
    }

    for (int i = 1; i < H; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < edge[j].size(); k++) {
                int ek = edge[j][k];
                dp[i][j] += dp[i-1][ek];
            }
        }
    }

    long long ans = 0;
    
    for (int i = 0; i < N; i++) {
        ans += dp[H-1][i];
    }

    cout << ans << endl;
    return 0;
}
